package rpa

import (
	"context"
	"git.mycaigou.com/gfyx/micro-gfyx-api/infrastructure/dto/rpa"
	repo_rpa "git.mycaigou.com/gfyx/micro-gfyx-api/infrastructure/repository/rpa"
)

type ByaiService struct {
	byAiRepo repo_rpa.ByaiRepositoryIface
}

// 构造函数
func NewByaiService(byAiRepo repo_rpa.ByaiRepositoryIface) ByaiServiceIface {
	return &ByaiService{byAiRepo: byAiRepo}
}

// 获取白应接口api
func (s *ByaiService) GetByaiToken(ctx context.Context, companyId int64, appId, secret string) (string, error) {
	return s.byAiRepo.GetByaiToken(ctx, companyId, appId, secret)
}

// 获取AI外呼任务详情
func (s *ByaiService) GetByaiTaskDetail(ctx context.Context, callJobId int64, companyId int64) (*rpa.GetByaiTaskData, error) {
	return s.byAiRepo.GetByaiTaskDetail(ctx, callJobId, companyId)
}

// 执行ai任务
func (s *ByaiService) ExecuteByAiTask(ctx context.Context, callJobId int64, companyId int64, command int32) (bool, error) {
	return s.byAiRepo.ExecuteByAiTask(ctx, callJobId, companyId, command)
}

// 向任务中导入客户
func (s *ByaiService) ImportCustomerToTask(ctx context.Context, callJobId int64, companyId int64, customerInfo []*rpa.CustomerInfoItem) (bool, error) {
	return s.byAiRepo.ImportCustomerToTask(ctx, callJobId, companyId, customerInfo)
}

//创建ai外呼任务
func (s *ByaiService) CreateByAiTask(ctx context.Context, params *rpa.ByAiTask) (int64, error) {
	return s.byAiRepo.CreateByAiTask(ctx, params)
}
